#pragma once

enum eJustify {
	JustifyLeft,
	JustifyCenter,
	JustifyRight
};

struct FreecamValue
{
	vec3 currentOrigin;
	vec3 currentAngles;

	vec3 savedOrigin;
	vec3 savedAngles;

	bool Noclip_RME;
};

extern partyMember_s partyMember[18];
extern FreecamValue Freecam;

extern void(*R_AddCmdDrawText)(char* text, int maxChars, int font, float x, float y, float xScale, float yScale, float rotation, color& color, int style);
extern void(*R_AddCmdDrawStretchPic)(float x, float y, float w, float h, float s0, float t0, float s1, float t1, color& color, int material);
extern int(*R_TextWidth)(int localClientNum, char* text, int maxChars, int font);
extern int(*R_TextHeight)(int font);
extern void(*CG_DrawRotatedPicPhysical)(int ScreenPlacement, float x, float y, float w, float h, float angle, color& color, int material);
extern int(*Material_RegisterHandle)(char* material, int imageTrack);
extern int(*CL_RegisterFont)(char* font, int imageTrack);
extern void(*CL_DrawTextPhysicalWithEffects)(char* text, int maxChars, int font, float x, float y, float w, float xScale, float yScale, color& colors, int style, color& glowColor, int fxMaterial, int fxMaterialGlow, int fxBirthTime, int fxLetterTime, int fxDecayStartTime, int fxDecayDuration);
extern char* (*va)(char* fmt, ...);
extern void(*MSG_Init)(msg_t* msg, char* data, int length);
extern void(*MSG_WriteLong)(msg_t* msg, int value);
extern void(*MSG_WriteByte)(msg_t* msg, int value);
extern void(*MSG_WriteShort)(msg_t* msg, int value);
extern void(*MSG_WriteData)(msg_t* msg, char* data, int length);
extern void(*NET_SendPacket)(netsrc_t socket, int length, char* data, netAdr_t to);
extern int(*Dvar_FindVar)(const char* dvarName);
extern bool(*CL_AllLocalClientsDisconnected)(void);
extern bool(*CG_IsEntityFriendlyNotEnemy)(int localClientNum, centity_s* entity);
extern short(*SL_GetString)(const char* bone, int localClientNum);
extern int(*Com_GetClientDObj)(int localClientNum, int unk);
extern bool(*CG_DObjGetWorldTagPos)(centity_s* cent, int DObj, short tagName, vec3& pos);
extern int(*BG_GetWeaponDef)(int weaponNum);
extern bool(*BG_UsingVehicleWeapon)(playerState_s* ps);
extern void(*BG_GetSpreadForWeapon)(playerState_s* ps, int weaponId, float* x, float* y);
extern int(*TransformSeed)(int* seed);
extern float(*RandomBulletDir)(int* randSeed);
extern void(*sub_82697FC0)(int* randSeed);
extern void(*FireBulletPenetrate)(int localClientNum, BulletFireParams* bp, int weaponId, centity_s* attacker, vec3& Origin, int one, bool unk, BulletTraceResults* br);
extern void(*CG_GetPlayerViewOrigin)(int localClientNum, playerState_s* ps, vec3& origin);
extern void(*CG_LocationalTrace)(trace_t* trace, vec3* start, vec3* end, int passEntityNum, int contMask, int u1, int u2);
extern int(*CG_GetWeaponIndexForName)(const char* weaponName);
extern void(*AngleVectors)(vec3* angles, vec3* forward, vec3* right, vec3* up);
extern void(*AnglesToAxis)(vec3* angles, vec3* axis);

extern void(*Cbuf_AddText)(int localClientNum, const char *text);

extern DWORD gClient(int clientNum);
extern DWORD gEntity(int clientNum);

extern uiContext_s get_uiContext();
extern centity_s get_centity(int clientNum);
extern cg_s* get_cg();
extern clientActive_s* get_clientActive();
extern partyData_s* get_active_party();
extern bool IsSpectating();
extern void DrawText(char* text, float x, float y, int font, float fontScale, color color);
extern void DrawTextWithEffects(char* text, float x, float y, int font, float fontScale, color textColor, color glowColor);
extern void DrawShader(float x, float y, float width, float height, int material, float angle, color color);
extern void DrawShaderWithOutline(float x, float y, float w, float h, color backgroundColor, color colorLeft, color colorRight, float lineWidth);
extern void DrawCenteredText(char* text, float x, float y, float fontScale, color color, float tabWidth);
extern void DrawInfobox(char* text, float x, float y, int Index);
extern void DrawInstruction(char* text, float x, float y, int font, float fontSize, color color, int index);
extern void DrawLine(float X1, float Y1, float X2, float Y2, float width, color color);
extern void DrawBox(FLOAT X, FLOAT Y, FLOAT W, FLOAT H, color Color);
extern float CalculateXValueWithAlign(float x, char* text, DWORD font, float scale, eJustify justify);
extern void DrawString(char* text, float x, float y, DWORD font, float scale, color color, eJustify justify);


extern bool Dvar_GetBool(char* dvarName);
extern bool CheckIsMigrating();
extern bool CheckInGame();
extern bool IsEnemy(int i);
extern bool IsAlive(int i);
extern bool WorldToScreen(vec3& WorldLocation, vec2& Screen);
extern vec3 GetTagPos(centity_s* cent, short tag);
extern void getWeaponAspectRatio(DWORD killIconType, float* aspectWidth, float* aspectHeight);
extern int GetWeaponIcon(int Weapon, float* aspectX, float* aspectY);
extern int GetLocalClientMaxHealth();
extern int GetLocalClientHealth();
extern vec3 GetPlayerViewOrigin();
extern bool IsClientVisible(int clientNum, short tag);
extern FLOAT ConvertThumbstickValue(SHORT sThumbstickValue, SHORT sDeadZone);
extern vec3 ClampAngles(vec3 angles);
extern void CG_CalcViewValues();
extern void NoClipToggle();
